﻿using System;
using UnityEngine;

// Token: 0x02000593 RID: 1427
public class FaceBlendShape : MonoBehaviour
{
	// Token: 0x06002224 RID: 8740 RVA: 0x00135BC8 File Offset: 0x00133DC8
	public virtual void Awake()
	{
		this.EyebrowCtrl.Init();
		this.EyesCtrl.Init();
		this.MouthCtrl.Init();
	}

	// Token: 0x06002225 RID: 8741 RVA: 0x00135BF0 File Offset: 0x00133DF0
	public virtual void SetBlinkControlEx(global::FBSBlinkControl ctrl)
	{
		this.BlinkCtrlEx = ctrl;
	}

	// Token: 0x06002226 RID: 8742 RVA: 0x00135BFC File Offset: 0x00133DFC
	public virtual void Start()
	{
	}

	// Token: 0x06002227 RID: 8743 RVA: 0x00135C00 File Offset: 0x00133E00
	public virtual void LateUpdate()
	{
		this.BlinkCtrl.CalcBlink();
		global::FBSBlinkControl fbsblinkControl = this.BlinkCtrl;
		if (this.BlinkCtrlEx != null)
		{
			fbsblinkControl = this.BlinkCtrlEx;
		}
		float blinkRate;
		if (fbsblinkControl.GetFixedFlags() == 0)
		{
			blinkRate = fbsblinkControl.GetOpenRate();
			if (this.EyeLookController)
			{
				float angleHRate = this.EyeLookController.eyeLookScript.GetAngleHRate(global::EYE_LR.EYE_L);
				float angleVRate = this.EyeLookController.eyeLookScript.GetAngleVRate();
				float min = -Mathf.Max(this.EyeLookDownCorrect, this.EyeLookSideCorrect);
				float num = 1f - this.EyeLookUpCorrect;
				if (num > this.EyesCtrl.OpenMax)
				{
					num = this.EyesCtrl.OpenMax;
				}
				float num2;
				if (angleVRate > 0f)
				{
					num2 = global::MathfEx.LerpAccel(0f, this.EyeLookUpCorrect, angleVRate);
				}
				else
				{
					num2 = -global::MathfEx.LerpAccel(0f, this.EyeLookDownCorrect, -angleVRate);
				}
				if (angleHRate > 0f)
				{
					num2 -= global::MathfEx.LerpAccel(0f, this.EyeLookSideCorrect, angleHRate);
				}
				else
				{
					num2 -= global::MathfEx.LerpAccel(0f, this.EyeLookSideCorrect, -angleHRate);
				}
				num2 = Mathf.Clamp(num2, min, this.EyeLookUpCorrect);
				num2 *= 1f - (1f - this.EyesCtrl.OpenMax);
				this.EyesCtrl.SetCorrectOpenMax(num + num2);
			}
		}
		else
		{
			blinkRate = -1f;
		}
		this.EyebrowCtrl.CalcBlend(blinkRate);
		this.EyesCtrl.CalcBlend(blinkRate);
		this.MouthCtrl.CalcBlend(this.voiceValue);
	}

	// Token: 0x06002228 RID: 8744 RVA: 0x00135DAC File Offset: 0x00133FAC
	public virtual void SetVoiceVaule(float value)
	{
		this.voiceValue = value;
	}

	// Token: 0x04002A9A RID: 10906
	protected global::FBSBlinkControl BlinkCtrlEx;

	// Token: 0x04002A9B RID: 10907
	public global::FBSBlinkControl BlinkCtrl;

	// Token: 0x04002A9C RID: 10908
	public global::FBSCtrlEyebrow EyebrowCtrl;

	// Token: 0x04002A9D RID: 10909
	public global::FBSCtrlEyes EyesCtrl;

	// Token: 0x04002A9E RID: 10910
	public global::FBSCtrlMouth MouthCtrl;

	// Token: 0x04002A9F RID: 10911
	protected float voiceValue;

	// Token: 0x04002AA0 RID: 10912
	public global::EyeLookController EyeLookController;

	// Token: 0x04002AA1 RID: 10913
	[Range(0f, 1f)]
	public float EyeLookUpCorrect = 0.1f;

	// Token: 0x04002AA2 RID: 10914
	[Range(0f, 1f)]
	public float EyeLookDownCorrect = 0.3f;

	// Token: 0x04002AA3 RID: 10915
	[Range(0f, 1f)]
	public float EyeLookSideCorrect = 0.1f;
}
